package com.RedRiver.hospitalsystem.personal_service.common.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;

public class Md5Util {
    public static String getMi(String pass){

        //得到md5加密对象
        MessageDigest md5 = null;
        try {
            md5 = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
//调用digest()对某个数据进行加密操作
        byte[] bytes = md5.digest(pass.getBytes());
//使用Base64将加密得到的字节数组重新编译为一个字符串
        String s = Base64.getEncoder().encodeToString(bytes);

        return s;
    }
}
